<script lang="ts" setup name="">
import { ref, reactive } from "vue";
import { useRoute } from "vue-router";
import OrgJobSchedulerForm from "./component/org-job-scheduler-form.vue";
import { redirectPath } from "@/utils/router-kit";
import { OrgJobSchedulerListUrl, OrgJobSchedulerEditUrl } from "@/views/org/mapping.json";
const currentRoute = useRoute();
const OrgJobSchedulerFormRef = ref<InstanceType<typeof OrgJobSchedulerForm> | null>(null);
const url = OrgJobSchedulerListUrl;
const OrgJobSchedulerFormState = reactive({
  uuid: currentRoute.params.id as string,

  /**
   * 保存按钮点击事件
   */
  onSaveButtonClick: () => {
    return OrgJobSchedulerFormRef.value.save();
  },
  /**
   * 新增成功回调函数
   */
  onAddFormSuccess: (formData: any) => {
    redirectPath(OrgJobSchedulerEditUrl + formData.uuid);
  }
});
</script>
<template>
  <div class="">
    <jxtech-basic-card title="定时任务管理">
      <template #operationSpace>
        <jxtech-save-button @click="OrgJobSchedulerFormState.onSaveButtonClick" v-auth="'org:xtpz:dsrwgl:save'">
        </jxtech-save-button>
        <JxtechBackButtonExt></JxtechBackButtonExt>
      </template>
      <org-job-scheduler-form
        ref="OrgJobSchedulerFormRef"
        :uuid="OrgJobSchedulerFormState.uuid"
        @add-success="OrgJobSchedulerFormState.onAddFormSuccess"
      ></org-job-scheduler-form>
    </jxtech-basic-card>
  </div>
</template>
